package com.faiz.example.springtest.controller;

import com.faiz.example.springtest.TestComponent;
import com.faiz.example.springtest.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

    final TestComponent testComponent;

    @Autowired
    public TestController(TestComponent testComponent) {
        this.testComponent = testComponent;
    }

    @GetMapping("hello")
    public String test() {
        return "hello!";
    }

    @GetMapping("test")
    public Student student() {
        return testComponent.testStudent();
    }
}
